package com.leonzhangxf.api;

import com.leonzhangxf.pojo.Test;
import com.leonzhangxf.repository.TestRepository;
import org.apache.curator.shaded.com.google.common.collect.Lists;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

/**
 * @author leonzhangxf
 */
@RestController
public class TestApi {

    private final TestRepository testRepository;

    public TestApi(TestRepository testRepository) {
        this.testRepository = testRepository;
    }

    @GetMapping("/tests")
    public Collection<Test> findAll() {
        return Lists.newArrayList(testRepository.findAll());
    }
}
